package com.atguigu.spring.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Objects;

/**
 * @author caodan
 * @version 1.0
 * @date 2022/5/9 9:33
 */
public class HelloCondition implements Condition {
	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		return Objects.requireNonNull(context.getBeanFactory()).containsBean("cat");
	}
}
